using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Threading;

namespace blogapi
{
    public partial class prihlasovaciform : Form
    {
        public prihlasovaciform(object bl,nastaveni nast)
        {
            InitializeComponent();
            blg =(blogs) bl;
            textBox1.Text = blg.user;
            textBox2.Text = blg.pass;
            label3.Text += "\r\n" + blg.url;
            nas = nast;
            setlang();
        }
        blogs blg;
        nastaveni nas;

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void prihlasovaciform_Closing(object sender, CancelEventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                if (DialogResult.No == MessageBox.Show(nas.getlang("emptyfield"), nas.getlang("empty"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
                {
                    e.Cancel = true;
                    return;
                }
            }
            blg.user = textBox1.Text;
            blg.pass = textBox2.Text;
        }

        private void setlang()
        {
            label1.Text = nas.getlang("username");
            label2.Text = nas.getlang("pass");
            label3.Text = nas.getlang("prihlasudaje");
            button1.Text = nas.getlang("login");
            checkBox1.Text = nas.getlang("rememberme");
            Text = "W - "+nas.getlang("prihlaseni");
        }
    }
}